<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="common/common_head :: commonHeader('发票预制')"/>
    <link th:href="@{/static/css/plugins/cropper/cropper.min.css}" rel="stylesheet">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight" style="padding-bottom: 0px;">
	<div class="row">
		<!-- 显示 隐藏测试 -->
		<!--
		<ul id="myTab" class="nav nav-tabs">
			<li class="active">
				<a href="#basicInfo" linkTab="basicInfo" isActive="true" formIndex="0" data-toggle="tab"> 发票信息</a>
			</li>
			<li>
				<a href="#enclosureInfo" linkTab="enclosureInfo" formIndex="1" data-toggle="tab"> 附件信息</a>
			</li>
		</ul>
		 -->
		
		<form class="form-horizontal" method="post" id="dataForm">
		<div class="form-group" style="margin-bottom:10px">
		    <div class="col-sm-8">
			     <input class="btn btn-primary" type="button" onclick="save()" value="保存" />
			     <button class="btn btn-primary" type="button" onclick="Dialog.closeFrame(window.name)">取 消</button>
		    </div>
		</div>
		<div id="basicInfo">
			<div class="ibox float-e-margins">
			    <div class="ibox-content">
			        <div class="form-group">
			            <label class="col-sm-1 control-label">发票类型：</label>
			            <div class="col-sm-3">
			                <select class="form-control" id="invoiceTypeSel" name="invoiceType" sysDict="FPLX" emptyFirst="true"></select>
			            </div>
			            <label class="col-sm-1 control-label">供应商发票号：</label>
			            <div class="col-sm-3">
			            	<input name="invoiceNo" type="text" placeholder="供应商发票号" class="form-control" />
			            </div>
			            <label class="col-sm-1 control-label">会计输入凭证：</label>
			            <div class="col-sm-3">
			            	<input name="kjsrPz" isDate="true" type="text" placeholder="会计输入凭证" class="form-control" />
			        	</div>
			        </div>
			        <div class="form-group">
			            <label class="col-sm-1 control-label">会计凭证编号：</label>
			            <div class="col-sm-3">
			                <input name="kjpzbh" type="text" placeholder="会计凭证编号" class="form-control" />
			            </div>
			            <label class="col-sm-1 control-label">发票日期：</label>
			            <div class="col-sm-3">
			                <input type="text" placeholder="发票日期" class="form-control" disabled="disabled" th:value= "${#dates.format(invoice.DateFp,'yyyy-MM-dd')}" />
			                <input name="dateFp" type="hidden" th:value= "${#dates.format(invoice.DateFp,'yyyy-MM-dd')}" />
			            </div>
			            <label class="col-sm-1 control-label">基准日期：</label>
			            <div class="col-sm-3">
			                <input name="dateJz" isDate="true" id="dateJzId" type="text" placeholder="基准日期" class="form-control" />
			            </div>
			        </div>
			        <div class="form-group">
			            <label class="col-sm-1 control-label">凭证抬头文本：</label>
			            <div class="col-sm-3">
			                <input name="bkTxt" type="text" placeholder="凭证抬头文本" class="form-control">
			            </div>
			            <label class="col-sm-1 control-label">备注：</label>
			            <div class="col-sm-3">
			                <input name="remark" type="text" placeholder="备注" class="form-control">
			            </div>
			            <label class="col-sm-1 control-label">公司代码：</label>
			            <div class="col-sm-3">
			                <input type="text" placeholder="公司代码" class="form-control" disabled="disabled" th:value="${invoice.compCode}" />
			                <input name="compCode" type="hidden" th:value= "${invoice.compCode}" />
			            </div>
			        </div>
			        <div class="form-group">
			            <label class="col-sm-1 control-label">对账单号：</label>
			            <div class="col-sm-3">
			                <input type="text" placeholder="对账单号" class="form-control" disabled="disabled" th:value="${invoice.billNo}" />
			                <input name="billNo" type="hidden" th:value= "${invoice.billNo}" />
			                <input name="billId" type="hidden" th:value= "${invoice.billId}" />
			            </div>
			             <label class="col-sm-1 control-label"><span class="required-sign">*</span>发票方：</label>
			             <div class="col-sm-3">
			                <input type="text" placeholder="发票方" class="form-control" disabled="disabled" th:value="${invoice.invoicePerson}" />
			                <input name="invoicePerson" type="hidden" th:value= "${invoice.invoicePerson}" />
			             </div>
			             <label class="col-sm-1 control-label">采购订单号：</label>
			             <div class="col-sm-3">
			             	<input type="text" placeholder="增采购订单号" class="form-control" disabled="disabled" th:value="${invoice.poNo}" />
			             	<input name="poNo" type="hidden" th:value= "${invoice.poNo}" />
						 </div>
			        </div>
					 <div class="form-group">
					      <label class="col-sm-1 control-label"><span class="required-sign">*</span>过账日期：</label>
					      <div class="col-sm-3">
					      	<input type="text" placeholder="过账日期" class="form-control" disabled="disabled" th:value= "${#dates.format(invoice.DateGz,'yyyy-MM-dd')}" />
					      	<input name="dateGz" type="hidden" th:value= "${#dates.format(invoice.DateGz,'yyyy-MM-dd')}" />
					      </div>
					     <label class="col-sm-1 control-label">采购组：</label>
					     <div class="col-sm-3">
					         <input type="text" placeholder="采购组" class="form-control" disabled="disabled" th:value="${invoice.purchGroup}" />
					         <input name="purchGroup" type="hidden" th:value= "${invoice.purchGroup}" />
					     </div>
					     <label class="col-sm-1 control-label">付款条件：</label>
					     <div class="col-sm-3">
					     		<input type="text" placeholder="付款条件" class="form-control" disabled="disabled" th:value="${invoice.paymentTerm}" />
					     		<input name="paymentTerm" type="hidden" th:value= "${invoice.paymentTerm}" />
					     </div>
					 </div>
			 		<div class="form-group">
			     	<label class="col-sm-1 control-label">发票总额：</label>
			     	<div class="col-sm-3">
			        	<input type="text" placeholder="发票总额" class="form-control" disabled="disabled" th:value="${invoice.sumMoney}" />
			        	<input name="sumMoney" type="hidden" th:value= "${invoice.sumMoney}" />
			     	</div>
			     	<label class="col-sm-1 control-label">税码：</label>
			     	<div class="col-sm-3">
			        	<input type="text" placeholder="税码" class="form-control" disabled="disabled" th:value="${invoice.taxCode}" />
			        	<input name="taxCode" type="hidden" th:value= "${invoice.taxCode}" />
			     	</div>
			      	<label class="col-sm-1 control-label">计算税额：</label>
			      	<div class="col-sm-3">
			        	<select class="form-control" name="taxMoney">
			                   	<option value="true">是</option><option value="false">否</option>
			            </select>
					</div>
			        </div>
					<div class="form-group">
						<label class="col-sm-1 control-label">税率：</label>
						<div class="col-sm-3">
							<input name="taxRate" type="text" placeholder="税率" class="form-control" />
						</div>
						<label class="col-sm-1 control-label">货币码：</label>
						<div class="col-sm-3">
							<input type="text" placeholder="货币码" class="form-control" disabled="disabled" th:value="${invoice.currency}" />
							<input name="currency" type="hidden" th:value= "${invoice.currency}" />
						</div>
						<label class="col-sm-1 control-label"></label>
						<div class="col-sm-3"></div>
					</div>
			    </div>
			</div>
		</div>
		</form>
	</div>
</div>

<!--引入公共js-->
<div th:include="common/onload_js :: onloadJS"></div>
<!-- Chosen -->
<script th:src="@{/static/js/plugins/chosen/chosen.jquery.js}"></script>

<!-- 文件上传的function -->
<script type="text/javascript">
	$(function () {
		//initTabBar("myTab");
		initDictDataSel();
		initDateText("isDate");
	});
	
	function save() {
		var data = $("#dataForm").serialize();
	    Page.ajaxPOST(ctxPath +"/invoice/genInvoices", data, function(o) {
	        if(o.code == 0) {
	        	Dialog.msg("生成预制发票成功!");
	        	Dialog.closeFrame(window.name);
	        	parent.refresh();
	        } else {
	        	Dialog.alert("生成预制发票失败!");
	        }
		}, {"loadingMsg" : "正在往服务器提交数据……"});
	}
</script>
</body>
</html>
